package cn.jesseyang.sqlitedemo;

import cn.jesseyang.sqlitedemo.domain.User;
import cn.jesseyang.sqlitedemo.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
public class SqliteDemoApplication {

    @Autowired
    UserMapper userMapper;

    public static void main(String[] args) {
        SpringApplication.run(SqliteDemoApplication.class, args);
    }



    @RequestMapping("/insert")
    public Object insert(String name){
        User user = new User();
        user.setName(name);
        userMapper.insert(user);
        return user;
    }

    @RequestMapping("/show")
    public Object show(){

        return userMapper.selectList(null);
    }
}
